<template>
  <div>
    <span v-for="(item, index) in arr" :key="index">
      <input v-model="num" type="checkbox" :value="item" > {{ item }}
    </span>

    <p>你选中的元素累加和为:{{ he }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      num: [],
    }
  },
  computed: {
    he() {
      return this.num.reduce((num, item) => num + item, 0)
    },
  },
  methods: {},
}
</script>

<style></style>
